<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Producto"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:graphicImage id="image" alt="jsf-sun" url="/Imagenes/#{productosController.selected.imagen}.jpg" styleClass="principal"/> 
                <h:panelGrid columns="2">
                    <h:outputText value="#{bundle.ViewProductosLabel_precio}"/>
                    <h:outputText value="#{productosController.selected.precio}€" title="#{bundle.ViewProductosTitle_precio}"/>
                    <h:outputText value="#{bundle.ViewProductosLabel_descripcion}"/>
                    <h:outputText value="#{productosController.selected.descripcion}" title="#{bundle.ViewProductosTitle_descripcion}"/>
                    
                    <h:outputText value="Entrega en 3 semanas" rendered="#{productosController.selected.stock==0}"/>
                    <h:outputText value="Entrega inmediata" rendered="#{!(productosController.selected.stock==0)}"/>
                    <h:outputText value=" "/>
                    <h:outputText value="Stock: "/>
                    <h:outputText value="#{productosController.selected.stock}" title="#{bundle.ViewProductosTitle_descripcion}"/>
                    
                    <h:outputText value="Cantidad: "/>
                    <h:selectOneMenu value="#{carritoController.quantity}">
                        <f:selectItem itemLabel="1" itemValue="1" />
                        <f:selectItem itemLabel="2" itemValue="2" />
                        <f:selectItem itemLabel="3" itemValue="3" />
                        <f:selectItem itemLabel="4" itemValue="4" />
                        <f:selectItem itemLabel="5" itemValue="5" />
                        <f:selectItem itemLabel="6" itemValue="6" />
                        <f:selectItem itemLabel="7" itemValue="7" />
                        <f:selectItem itemLabel="8" itemValue="8" />
                        <f:selectItem itemLabel="9" itemValue="9" />
                        <f:selectItem itemLabel="10" itemValue="10" />
                    </h:selectOneMenu>
                    <h:commandButton action="#{carritoController.addItem}" value="#{bundle.AgnadirAlCarrito}">
                        <f:param name="param" value="#{productosController.selected.id}" />
                    </h:commandButton>
                    <br /> 
                </h:panelGrid>
            </h:form>
            <h:form>
             <h:commandLink value="Volver" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
